<!DOCTYPE html>
<html>
<head>
    <title>节点属性</title>
    <meta charset="UTF-8"/>
    <link rel="stylesheet" type="text/css" href="../../easyui/themes/gray/easyui.css"/>
    <link rel="stylesheet" type="text/css" href="../../easyui/themes/icon.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/app_openform.css"/>

    <script type="text/javascript" src="../../easyui/jquery.min.js"></script>
    <script type="text/javascript" src="../../easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../../jscode/sharefunction.js"></script>
    <script type="text/javascript" src="../../jscode/app_openform.js"></script>
    <script>

        var CONFIG = [];
        $.ajax({
            url: "../config/config.json",
            //同步请求
            async: false,
            type: 'GET',
            success: function (data) {
                CONFIG = data;
            }
        });

        function formonload() {
            var Nodeid = GetUrlArg("Nodeid");
            $("#Nodeid").html(Nodeid);
            $('#event').attr("src", "../view/CommonEventView.html?eventType=Event&WF_Action=edit&WF_DocUnid=&Processid=" + GetUrlArg("Processid") + "&Nodeid=" + GetUrlArg("Nodeid") + "&NodeType=" + GetUrlArg("ExtNodeType") + "&WF_Appid=S029")

            var processAttrUrl = CONFIG.url.getFlowChartModByNodeType;
            processAttrUrl = processAttrUrl.replace("{processid}", GetUrlArg("Processid")).replace("{nodeid}", GetUrlArg("Nodeid"));

            $.ajax({
                async: false,
                type: "GET",
                url: processAttrUrl,
                dataType: "json",
                success: function (data) {
                    for (var key in data['基本属性']) {
                        if (key === 'ExtNodeType') {
                            $('#ExtNodeType').combobox('setValue', data['基本属性'][key]);
                        }
                        $('#' + key).val(data['基本属性'][key]);
                    }
                }
            });
        }

        function myBrowser() {
            var userAgent = navigator.userAgent;
            var isOpera = userAgent.indexOf("Opera") > -1;
            if (isOpera) {
                return "Opera"
            }
            ;
            if (userAgent.indexOf("Firefox") > -1) {
                return "FF";
            }
            if (userAgent.indexOf("Chrome") > -1) {
                return "Chrome";
            }
            if (userAgent.indexOf("Safari") > -1) {
                return "Safari";
            }
            if (!!window.ActiveXObject || "ActiveXObject" in window) {
                if (navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE10.0") {
                    return "IE10"
                }
                return "IE"
            }
            ;
        }

        function SaveDocument(btnAction) {
            //var postData = "Processid="+GetUrlArg("Processid")+"&Nodeid={Nodeid}&QryNodeType="+GetUrlArg("ExtNodeType")+"";

            var map = {};
            $("input").each(function () {
                var input = $(this);
                if (input.attr("id") !== undefined)
                    map[input.attr("id")] = input.val();
            });
            map['ExtNodeType'] = $('#ExtNodeType').combobox('getValue');
            var postData = {
                "json": JSON.stringify(map)
            }

            var saveFlowAttrUrl = CONFIG.url.saveFlowChartModByNodeType;
            saveFlowAttrUrl = saveFlowAttrUrl.replace("{processid}", GetUrlArg("Processid")).replace("{nodeid}", GetUrlArg("Nodeid")).replace("{extnodetype}", GetUrlArg("ExtNodeType"));

            mask();
            $.post(saveFlowAttrUrl,
                postData, function (data) {
                    unmask();
                    if (data.Status == "error") {
                        $.messager.alert("Info", data.msg, "Error");
                    } else {
                        var NodeName = $("#NodeName").val();
                        var Nodeid = GetUrlArg("Nodeid");
                        if (btnAction == "quit") {
                            window.close();
                        }
                    }
                });
        }

        $(function () {
            $("#tabs").tabs({
                onSelect: loadUrl
            });
            loadUrl();
        });

        function loadUrl() {
            var tab = $('#tabs').tabs('getSelected');
            if (tab == null) {
                return false;
            }
            var url = tab.attr("url");
            var id = tab.attr("id");
            if ($("#iframe_" + id).attr("src") == "about:blank") {
                $("#iframe_" + id).attr("src", url);
            }
        }</script>
</head>
<body style="margin:0px;overflow:hidden">
<div class="easyui-layout" id="panel" fit="true" style="width:100%;">
    <div data-options="region:'north',split:false" border="false" style="height:31px;overflow:hidden">
        <div class="toptoolbar" id="toptoolbar">
            |
            <a href="#" class="easyui-linkbutton" plain="true" data-options="iconCls:'icon-save'"
               onclick="SaveDocument('quit')">保存退出</a> |
            <a href="#" class="easyui-linkbutton" plain="true" data-options="iconCls:'icon-save'"
               onclick="SaveDocument()">保存</a> |
            <a href="#" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-remove'"
               onclick="window.close();">关闭</a>
        </div>
    </div>
    <div region="center" border="false" fit="false">
        <div id="tabs" class="easyui-tabs" fit="true" tabposition="left" data-options="showHeader:true,tabHeight:30">
            <div title="基本属性" id="eventattr" iconCls="" style="padding:0px;overflow:hidden">
                <table class="linkeytable">
                    <tbody>
                    <tr class="firstRow">
                        <td style="word-break: break-all;" valign="middle" rowspan="1" colspan="1" align="right">事件名称
                        </td>
                        <td valign="middle" rowspan="1" colspan="1" align="left"><input id="NodeName" name="NodeName"
                                                                                        value="" size="40"/><span
                                style="color:red;display:none">该项为必填项</span></td>
                    </tr>
                    <tr>
                        <td style="word-break: break-all;" valign="middle" rowspan="1" colspan="1" align="right">节点id
                        </td>
                        <td valign="middle" rowspan="1" colspan="1" align="left">
		<span id="Nodeid" class="ue_t" name="Nodeid" type="xfield">{xfield}
		</span>
                        </td>
                    </tr>
                    <tr>
                        <td style="word-break: break-all;" valign="middle" width="178" align="right">事件类型</td>
                        <td valign="middle" width="748"><select style="width: 200px;" id="ExtNodeType"
                                                                class="easyui-combobox" name="ExtNodeType"
                                                                exttype="comboselect">
                            <option value="frontEvent">节点前置事件(frontEvent)</option>
                            <option value="rearEvent">节点后置事件(rearEvent)</option>
                        </select></td>
                    </tr>
                    </tbody>
                </table>
            </div>

            <div title="事件设置" id="rule" iconCls="icon-event" style="padding:0px;overflow:hidden">
                <iframe id="event" src="" frameborder="0" style="width:100%;height:100%"></iframe>
            </div>

        </div>
    </div>
</div>
</body>
</html>